home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / libg_261.zip / libg_261 / libio / builtinbuf.cc next >
C/C++ Source or Header  |  1994-06-22  |  3KB  |  97 lines

  1. /* 
  2. Copyright (C) 1993 Free Software Foundation
  3.  
  4. This file is part of the GNU IO Library.  This library is free
  5. software; you can redistribute it and/or modify it under the
  6. terms of the GNU General Public License as published by the
  7. Free Software Foundation; either version 2, or (at your option)
  8. any later version.
  9.  
  10. This library is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. GNU General Public License for more details.
  14.  
  15. You should have received a copy of the GNU General Public License
  16. along with GNU CC; see the file COPYING.  If not, write to
  17. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  
  19. As a special exception, if you link this library with files
  20. compiled with a GNU compiler to produce an executable, this does not cause
  21. the resulting executable to be covered by the GNU General Public License.
  22. This exception does not however invalidate any other reasons why
  23. the executable file might be covered by the GNU General Public License. */
  24.  
  25. #ifdef __GNUC__
  26. #pragma implementation
  27. #endif
  28. #define _STREAM_COMPAT
  29. #include "builtinbuf.h"
  30. #include "iostreamP.h"
  31.  
  32. int builtinbuf::overflow(int ch) { return (*_jumps->__overflow)(this, ch); }
  33.  
  34. int builtinbuf::underflow() { return (*_jumps->__underflow)(this); }
  35.  
  36. streamsize builtinbuf::xsgetn(char* buf, streamsize n)
  37. { return (*_jumps->__xsgetn)(this, buf, n); }
  38.  
  39. streamsize builtinbuf::xsputn(const char* buf, streamsize n)
  40. { return _jumps->__xsputn (this, buf, n); }
  41.  
  42. int builtinbuf::doallocate() { return _jumps->__doallocate(this); }
  43.  
  44. builtinbuf::~builtinbuf() { _jumps->__finish(this); }
  45.  
  46. int builtinbuf::sync() { return _jumps->__sync(this); }
  47.  
  48. streambuf* builtinbuf::setbuf(char *buf, int n)
  49. { return _jumps->__setbuf (this, buf, n) == 0 ? this : NULL; }
  50.  
  51. streampos builtinbuf::seekoff(streamoff off, _seek_dir dir, int mode)
  52. {
  53.   return _jumps->__seekoff (this, off, convert_to_seekflags(dir, mode));
  54. }
  55.  
  56. streampos builtinbuf::seekpos(streampos pos, int mode)
  57. {
  58.   int flags = 0;
  59.   if (!(mode & ios::in))
  60.     flags |= _IO_seek_not_in;
  61.   if (!(mode & ios::out))
  62.     flags |= _IO_seek_not_out;
  63.   return _jumps->__seekpos(this, pos, (_IO_seekflags)flags);
  64. }
  65.  
  66. int builtinbuf::pbackfail(int c)
  67. { return _jumps->__pbackfail(this, c); }
  68.  
  69. streamsize builtinbuf::sys_read(char* buf, streamsize size)
  70. { return _jumps->__read(this, buf, size); }
  71.  
  72. streampos builtinbuf::sys_seek(streamoff off, _seek_dir dir)
  73. { return _jumps->__seek(this, off, dir); }
  74.  
  75. streamsize builtinbuf::sys_write(const char* buf, streamsize size)
  76. { return _jumps->__write(this, buf, size); }
  77.  
  78. int builtinbuf::sys_stat(void* buf) // Actually, a (struct stat*)
  79. { return _jumps->__stat(this, buf); }
  80.  
  81. int builtinbuf::sys_close()
  82. { return _jumps->__close(this); }
  83.  
  84. #ifdef _STREAM_COMPAT
  85. /* These methods are TEMPORARY, for binary compatibility! */
  86. #include <stdlib.h>
  87. void ios::_IO_fix_vtable() const
  88. {
  89.   abort ();
  90. }
  91.  
  92. void ios::_IO_fix_vtable()
  93. {
  94.   ((const ios*) this)->_IO_fix_vtable();
  95. }
  96. #endif
  97.